Skip to content

[6.x] Fix timezone handling in whereDate and whereTime#14940

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
marcorieser:fix/where-date-time-timezone
Jul 6, 2026
Merged

[6.x] Fix timezone handling in whereDate and whereTime#14940
jasonvarga merged 1 commit into
statamic:6.xfrom
marcorieser:fix/where-date-time-timezone

Conversation

@marcorieser

Copy link
Copy Markdown
Contributor

Closes: #14939

Summary

  • whereDate() / whereTime() reparsed Carbon/DateTimeInterface values using the app's default timezone instead of converting them, silently shifting the compared instant when the passed value was in a different timezone.
  • Both now convert the value to config('app.timezone') before truncating to the date/time part.

Test plan

  • Added tests covering whereDate/whereTime with a Carbon instance in a non-app timezone
  • Existing whereDate/whereMonth/whereDay/whereYear/whereTime tests still pass

Carbon values in a non-app timezone were reparsed using the app's
default timezone, silently shifting the represented instant instead
of converting it.
@marcorieser marcorieser changed the title [6x] Fix timezone handling in whereDate and whereTime [6.x] Fix timezone handling in whereDate and whereTime Jul 4, 2026
@jasonvarga jasonvarga merged commit b5d59a4 into statamic:6.x Jul 6, 2026
20 of 21 checks passed
@marcorieser marcorieser deleted the fix/where-date-time-timezone branch July 6, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

whereDate() / whereTime() ignore timezone of Carbon/DateTimeInterface values, shifting comparison instant

2 participants